import requests

from config import ihrm_url
from common.ihrm_log import init_log_config

class yyq_Test_wj:
    @classmethod
    def IhrmLogin(cls, json) -> requests.Response():
        url = f'{ihrm_url}/api/sys/login'

        headers = {
            "Content-Type": "application/json"
        }
        r = requests.post(url=url, headers=headers, json=json)
        return r

    @classmethod
    def test_post_peole(cls, add_json,token) -> requests.Response():
        url = f'{ihrm_url}/api/sys/user'
        headers = {
            "Content-Type": "application/json",
            "Authorization": token
        }
        r = requests.post(url=url, headers=headers, json=add_json)
        return r

    @classmethod

    def test_put_peole(cls, add_json, token,id) -> requests.Response():
        url = f'{ihrm_url}/api/sys/user/{id}'
        headers = {
            "Content-Type": "application/json",
            "Authorization": token
        }
        r = requests.put(url=url, headers=headers, json=add_json)
        return r

    @classmethod
    def test_delete_peole(cls, token,id) -> requests.Response():
        url = f'{ihrm_url}/api/sys/user/{id}'
        headers = {
            "Content-Type": "application/json",
            "Authorization": token
        }
        r = requests.delete(url=url,headers=headers)
        return r
